﻿using System;
using System.Linq;

class Program
{
    static int FirstBiggerThanItsNeighbours(int[] array)
    {
        for (int possition = 0; possition < array.Length; possition++)
        {
            if (possition < 0 || possition > array.Length-1)
            {
                return -1;
            }
            else if (possition != 0 && possition != array.Length - 1)
            {
                if (array[possition] > array[possition - 1] && array[possition] > array[possition + 1])
                {
                    return possition;
                }

            }
            else if (possition==0)
            {
                if (array[possition] > array[possition + 1])
                {
                    return possition;
                }
            }
            else if (possition == array.Length-1)
            {
                if (array[possition] > array[possition - 1])
                {
                    return possition;
                }
            }
        }
        return -1;
    }

    static void Main()
    {
        int[] myArray = { 1, 4, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 5, 5, 5, 6, 6, 7, 8 };
        Console.WriteLine(FirstBiggerThanItsNeighbours(myArray));
    }
}


